1. Field of the Present Invention
The present invention relates to a method and an apparatus of RGB color-space conversion, more particularly, relates to a method and an apparatus of luminance compensation after adjustments of saturation and/or hue.
2. Description of Related Art
H.S.I. (Hue, Saturation, Intensity) color system is defined by a color triangle connected by R, G, B points in a chromaticity diagram. Hue is expressed by angle, regarding the hue of red color as 0 degree, the central point white color as a center point, and then a rotation angle θ from the white-red line in an anticlockwise direction will denote a corresponding color. Saturation is expressed by percentage, the saturation of pure color is 100%, and the saturation of the central white is 0%. Intensity indicates an average of RGB intensities.
The conversion between RGB and HSI can be applied in merge of high-resolution images and low-resolution images. A process of combining a fine fall-waveband black/white image and a coarse multi-spectrum image into a fine color image is to calculate luminance based on the RGB combination, then the luminance is the full-waveband black/white image, if the luminance of an image in the HSI is replaced by a fine black/white image and then the image is returned back to a RGB image, the spatial information of the original fine black/white image is increased, and a color having higher resolution is obtained.
Values of the aforementioned intensity, saturation or hue (indicated by I, S, and H, respectively) are from 0 to 1, 0 to 1 and 0 to 360, respectively. The conversion between RGB and HSI can be performed as following: provided that M is max(R,G,B), i.e. the maximum of RGB, and m is min(R,G,B), i.e. the minimum of the RGB, then:
r=(M-R)/(M−m);
g=(M-G)/(M−m);
b=(M-B)/(M−m);
I=(M+m)/2;
S=0, if M=m;
S=(M−m)/(M+m), if I<=0.5;
S=(M−m)/(2-M−m), if I>0.5;
H=60(b-g), if M=R;
H=60(2+r-b), if M=G;
H=60(4+g-r), if M=B.
A conventional operating method of the RGB color-space conversion based on the RGB-HSI conversion is shown in FIG. 1. Firstly, according to step 110, global saturation adjustment is performed on RGB values. Secondly, according to step 120, global hue adjustment is performed on the result of the first step. Thirdly, according to step 130, local hue adjustment is performed on the result of the second step. Finally, according to step 140, local saturation adjustment is performed to obtain R′, G′ and B′ values.
However, when global or local adjustment of hue or saturation is performed during the RGB color-space conversion based on the RGB-HSI conversion, pixel luminance will be changed. That will cause the luminance of images not as good as expected, even result in distortion.